package com.wdd.libhttp.rx;

import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.ObservableTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * @ProjectName: Tools
 * @Package: com.wdd.tool.http
 * @ClassName: RxSchedulers
 * @Description: java类作用描述
 * @Author: 王丹丹
 * @CreateDate: 2019/6/29 12:40
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/6/29 12:40
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class RxSchedulers {

     static final ObservableTransformer schedulersTransformer = new ObservableTransformer() {
        @Override
        public ObservableSource apply(Observable upstream) {
            return (upstream).subscribeOn(Schedulers.io())
                    .observeOn(AndroidSchedulers.mainThread());
        }
    };

    public static <T> ObservableTransformer<T, T> applySchedulers() {
        return (ObservableTransformer<T, T>) schedulersTransformer;
    }


}
